package cn.galudisu.reactivemanifesto.interceptor

import akka.http.scaladsl.server.Directive0

trait InterceptorDirectives {

  import akka.http.scaladsl.server.directives.BasicDirectives._

  def intercept(magnet: InterceptorMagnet[Directive0]): Directive0 = {
    extractRequest.flatMap { request =>
      magnet.f(request)
    }
  }
}

object InterceptorDirectives extends InterceptorDirectives
